<?php

use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use Illuminate\Support\Facades\Route;

empty(defined('CURL_SSLVERSION_TLSv1_2')) && define('CURL_SSLVERSION_TLSv1_2', 6);
return Application::configure(basePath: dirname(__DIR__))
  ->withRouting(
    using: function () {
      Route::middleware('web')->group(app_path('Routes/web.php'));
      Route::middleware('api')->group(app_path('Routes/api.php'));
      //模块路由
      if (config('module.enabled')) {
        $moduleList = config('module.moduleList');
        foreach ($moduleList as $module) {
          Route::middleware('api')->group(base_path('module') . "/" . $module . '/route.php');
        }
      }
    },
    commands: __DIR__ . '/../app/Routes/console.php',
    channels: __DIR__ . '/../app/Routes/channels.php',
    health: '/up',
  )
  ->withMiddleware(function (Middleware $middleware) {
    //
  })
  ->withExceptions(function (Exceptions $exceptions) {
    //
  })->create();
